package com.health.httpbean.upload;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;

import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.blankj.utilcode.util.Utils;
import com.health.httpbean.HttpConstant;
import com.health.httpbean.HttpNewConstant;
import com.health.httpbean.HttpResultBean;
import com.health.httpbean.model.ArchiveBean;
import com.health.model.LvYueFuWuBean;
import com.health.tablebean.ARCHIVE_BASEINFO;
import com.health.tablebean.JTYSDoctorEvaluateBean;
import com.health.tablebean.JTYS_SignPictureData;
import com.health.tablebean.webservice.ChildWithOneYearOld;
import com.health.tablebean.webservice.ChildhealthNeonate;
import com.health.tablebean.webservice.CoronaryHeartDisease;
import com.health.tablebean.webservice.Diabetes;
import com.health.tablebean.webservice.FeiXinBing;
import com.health.tablebean.webservice.FengShiBing;
import com.health.tablebean.webservice.FirstPrenatalVisit;
import com.health.tablebean.webservice.HdDiseaseManageStroke;
import com.health.tablebean.webservice.HdPersonalInfo;
import com.health.tablebean.webservice.HealthCheck;
import com.health.tablebean.webservice.Hypertensio;
import com.health.tablebean.webservice.JsjbBaseInfo;
import com.health.tablebean.webservice.Jsjbsfb;
import com.health.tablebean.webservice.LeiFengShi;
import com.health.tablebean.webservice.ManZuFei;
import com.health.tablebean.webservice.MaternalFortyTwoDaysVisits;
import com.health.tablebean.webservice.MaternalPostnatalVisits;
import com.health.tablebean.webservice.MonthsChildHomeVisit;
import com.health.tablebean.webservice.OldPhysique;
import com.health.tablebean.webservice.OldSelfHelp;
import com.health.tablebean.webservice.QyinfoUploadBean;
import com.health.tablebean.webservice.SecondToFifthPrenatalVisits;
import com.health.tablebean.webservice.TuberculosisBaseInfo;
import com.health.tablebean.webservice.TuberculosisFollowUpInfo;
import com.health.tablebean.webservice.YearChildHomeVisit;
import com.health.tools.GlobalConts;
import com.health.tools.ImageTools;
import com.health.tools.JX_UploadData;
import com.health.tools.ModuleName;
import com.health.tools.SPUtil;
import com.health.tools.UploadDataBean;
import com.health.httpbean.upload.ArchiveUploadDatas;
import com.health.viewscontrols.NovaApplication;
import com.health.viewscontrols.settings.DataDownLoadMainActivity;

import java.util.ArrayList;
import java.util.List;

import rxhttp.RxHttp;


public class ArchiveUploadWebService {

    private Context context;
    private boolean isUploadPicture = false;
    List<HdPersonalInfo> convertDataInfo;//个人基本信息
    List<Diabetes> convertDataTnb;//糖尿病
    /**
     * 肺结核第一次入户随访上传接口参数（基本信息）
     */
    List<TuberculosisBaseInfo> convertDataFjhBaseInfo;
    /**
     * 肺结核随访上传接口参数（随访信息）
     */
    List<TuberculosisFollowUpInfo> convertDataFjhFollowUpInfo;
    List<Hypertensio> convertDataGxy;//高血压
    List<CoronaryHeartDisease> convertDataGXB;//冠心病
    List<HdDiseaseManageStroke> convertDataNCZ;//脑卒中
    List<HealthCheck> convertDataJktj;//健康体检
    List<OldPhysique> convertDataLnrzyy;//老年人中医药
    List<OldSelfHelp> convertDataLnrzlnl;//老年人自理能力
    //    List<JTYSCustomerDoctorCont> conts;//签约用户
    List<QyinfoUploadBean> contsQyyh;//签约用户

    List<JTYSDoctorEvaluateBean> evaluates;//用户满意度
    List<ChildhealthNeonate> convertDataXSRFS;//新生儿访视
    List<ChildWithOneYearOld> convertDataOneMonth;//满月内检查
    List<ChildWithOneYearOld> convertDataThreeMonth;//三月龄
    List<ChildWithOneYearOld> convertDataSixMonth;//六月龄
    List<ChildWithOneYearOld> convertData8Month;//八月龄
    List<JsjbBaseInfo> converJsjbInfo;//严重精神病基本信息
    List<Jsjbsfb> converJsjbsfb;//严重精神病随访
    List<JTYS_SignPictureData> pictures;//照片
    List<LvYueFuWuBean> lvYueFuWuBeans;//履约服务

    List<FeiXinBing> feiXinBingFollowups;//肺心病
    List<LeiFengShi> leiFengShiFollowups;//类风湿
    List<ManZuFei> manZuFeiFollowups;//慢阻肺
    List<FengShiBing> fengShiBingFollowups;//风湿病
    /**
     * 12月龄儿童家庭访视
     */
    List<MonthsChildHomeVisit> convertData12Month;
    /**
     * 18月龄儿童家庭访视
     */
    List<MonthsChildHomeVisit> convertData18Month;
    /**
     * 24月龄儿童家庭访视
     */
    List<MonthsChildHomeVisit> convertData24Month;
    /**
     * 30月龄儿童家庭访视
     */
    List<MonthsChildHomeVisit> convertData30Month;
    /**
     * 三岁儿童家庭访视
     */
    List<YearChildHomeVisit> convertData3Year;
    /**
     * 四岁儿童家庭访视
     */
    List<YearChildHomeVisit> convertData4Year;
    /**
     * 五岁儿童家庭访视
     */
    List<YearChildHomeVisit> convertData5Year;
    /**
     * 六岁儿童家庭访视
     */
    List<YearChildHomeVisit> convertData6Year;
    /**
     * 第一次产前访视
     */
    List<FirstPrenatalVisit> convertDataTheFirstTimePrenatalVisit;
    /**
     * 第2次产前随访
     */
    List<SecondToFifthPrenatalVisits> convertData2TimesPrenatalVisits;
    /**
     * 第3次产前随访
     */
    List<SecondToFifthPrenatalVisits> convertData3TimesPrenatalVisits;
    /**
     * 第4次产前随访
     */
    List<SecondToFifthPrenatalVisits> convertData4TimesPrenatalVisits;
    /**
     * 第5次产前随访
     */
    List<SecondToFifthPrenatalVisits> convertData5TimesPrenatalVisits;
    /**
     * 孕产妇产后访视
     */
    List<MaternalPostnatalVisits> convertDataMaternalPostnatalVisits;
    /**
     * 孕产妇产后42天健康检查
     */
    List<MaternalFortyTwoDaysVisits> convertDataMaternalFortyTwoDaysVisits;


    /**
     * 上传档案到老平台
     */
    public void uploadWebServiceArchive(Context context) {
        if (!GlobalConts.isNetworkAvailable(Utils.getApp())) {
            // showTextDialog("请先检查网络");
            return;
        }

        this.context = context;
        isUploadPicture = false;
        convertDataInfo = HdPersonalInfo.convertData(context);
        convertDataTnb =
                Diabetes.convertData(context);
        Log.e("糖尿病", convertDataTnb.size() + "*********");
        /* 肺结核第一次随访*/
        convertDataFjhBaseInfo =
                TuberculosisBaseInfo.convertData(context);
        /* 肺结核随访信息*/
        convertDataFjhFollowUpInfo =
                TuberculosisFollowUpInfo.convertData(context);
        convertDataGxy =
                Hypertensio.convertData(context);
        Log.e("高血压", convertDataGxy.size() + "*********");
        if (convertDataGxy.size() > 0) {
            Log.e("personalid", convertDataGxy.get(0).getPersonalid() + "*********");
        }
//        sendFollowTable();
        convertDataGXB =
                CoronaryHeartDisease.convertData(context);
        convertDataNCZ =
                HdDiseaseManageStroke.convertData(context);
        convertDataJktj =
                HealthCheck.convertData(context);
        convertDataLnrzyy =
                OldPhysique.convertData(context);
        convertDataLnrzlnl =
                OldSelfHelp.convertData(context);
        convertDataXSRFS =
                ChildhealthNeonate.convertData(context);
        convertDataOneMonth =
                ChildWithOneYearOld.convertData(context, "1");
        convertDataThreeMonth =
                ChildWithOneYearOld.convertData(context, "2");
        convertDataSixMonth =
                ChildWithOneYearOld.convertData(context, "3");
        convertData8Month =
                ChildWithOneYearOld.convertData(context, "4");
        /*获取12月龄上传参数*/
        convertData12Month =
                MonthsChildHomeVisit.convertData(context, "1");
        /*获取18月龄上传参数*/
        convertData18Month =
                MonthsChildHomeVisit.convertData(context, "2");
        /*获取24月龄上传参数*/
        convertData24Month =
                MonthsChildHomeVisit.convertData(context, "3");
        /*获取30月龄上传参数*/
        convertData30Month =
                MonthsChildHomeVisit.convertData(context, "4");
        /*获取3岁上传参数*/
        convertData3Year =
                YearChildHomeVisit.convertData(context, "3");
        /*获取4岁上传参数*/
        convertData4Year =
                YearChildHomeVisit.convertData(context, "4");
        /*获取5岁上传参数*/
        convertData5Year =
                YearChildHomeVisit.convertData(context, "5");
        /*获取6岁上传参数*/
        convertData6Year =
                YearChildHomeVisit.convertData(context, "6");
        /*第一次产前访视*/
        convertDataTheFirstTimePrenatalVisit =
                FirstPrenatalVisit.convertData(context);
        /* 第2次产前随访*/
        convertData2TimesPrenatalVisits =
                SecondToFifthPrenatalVisits.convertData(context, "2");
        /* 第3次产前随访*/
        convertData3TimesPrenatalVisits =
                SecondToFifthPrenatalVisits.convertData(context, "3");
        /* 第4次产前随访*/
        convertData4TimesPrenatalVisits =
                SecondToFifthPrenatalVisits.convertData(context, "4");
        /* 第5次产前随访*/
        convertData5TimesPrenatalVisits =
                SecondToFifthPrenatalVisits.convertData(context, "5");
        /*孕产妇产后访视*/
        convertDataMaternalPostnatalVisits =
                MaternalPostnatalVisits.convertData(context);
        /*孕产妇产后42天健康检查*/
        convertDataMaternalFortyTwoDaysVisits =
                MaternalFortyTwoDaysVisits.convertData(context);

        converJsjbInfo = JsjbBaseInfo.convertData(context);
        converJsjbsfb = Jsjbsfb.convertData(context);
        contsQyyh= QyinfoUploadBean.convertData(context);
        if(NovaApplication.dbManger.checkColumnExists("LvYueFuWuBean","is_Update")&&NovaApplication.dbManger.checkColumnExists("LvYueFuWuBean","creater")){
            lvYueFuWuBeans=NovaApplication.fdbmanger.findAllByWhere(LvYueFuWuBean.class,"is_Update is not 'N'"+"and creater='"+NovaApplication.getJgrno()+"'");
        }else{
            NovaApplication.dbManger.addColumnByBySQL("LvYueFuWuBean","is_Update");
            NovaApplication.dbManger.addColumnByBySQL("LvYueFuWuBean","creater");
            List<LvYueFuWuBean> list=NovaApplication.fdbmanger.findAllByWhere(LvYueFuWuBean.class,"is_Update is not 'N'");
            if(list.size()>0){
                for(LvYueFuWuBean lvYueFuWuBean:list){
                    lvYueFuWuBean.setIs_Update("Y");
                    lvYueFuWuBean.setCreater(NovaApplication.getJgrno());
                    NovaApplication.fdbmanger.updata(lvYueFuWuBean);
                }
            }
            lvYueFuWuBeans=NovaApplication.fdbmanger.findAllByWhere(LvYueFuWuBean.class,"is_Update is not 'N'"+"and creater='"+NovaApplication.getJgrno()+"'");
        }
        //获取未上传肺心病随访数据
        feiXinBingFollowups= FeiXinBing.convertData(context);
        //获取未上传类风湿随访数据
        leiFengShiFollowups= LeiFengShi.convertData(context);
        //获取未上传慢阻肺随访数据
        manZuFeiFollowups= ManZuFei.convertData(context);
        //获取未上传风湿病随访数据
        fengShiBingFollowups= FengShiBing.convertData(context);





        pictures = NovaApplication.fdbmanger.findAllByWhere(JTYS_SignPictureData.class,
                "createrId='" + SPUtil.getstr_jdrusername(context) + "' AND isUpdate ='Y'");
        List<JTYS_SignPictureData> pictures1 = NovaApplication.fdbmanger.findAllByWhere(JTYS_SignPictureData.class,
                "createrId='" + SPUtil.getStr_jdrno(context) + "' AND isUpdate ='Y'");
        if(pictures1.size()>0){
            pictures.addAll(pictures1);
        }
        for(JTYS_SignPictureData jtys_signPictureData:pictures){
            jtys_signPictureData.setCardNum(TextUtils.isEmpty(jtys_signPictureData.getCardNum()) ? "" : jtys_signPictureData.getCardNum().toUpperCase());
        }
        evaluates = NovaApplication.fdbmanger.findAllByWhere(JTYSDoctorEvaluateBean.class,
                "CREATER='" + NovaApplication.getJgrno() + "' AND SIGN ='0'");
        for(JTYSDoctorEvaluateBean jtysDoctorEvaluateBean:evaluates){
            jtysDoctorEvaluateBean.setCardNum(TextUtils.isEmpty(jtysDoctorEvaluateBean.getCardNum()) ? "" : jtysDoctorEvaluateBean.getCardNum().toUpperCase());
        }

        handler.sendEmptyMessage(1);
    }

    int s = 0;
    int f = 0;
    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                case 11:
                    String count = (String) msg.getData().get("count");
                    System.out.println("拉取数据："+count);
                    String[] counts = count.split("/");
                    s = s + Integer.parseInt(counts[0]);
                    f = f + Integer.parseInt(counts[1]);
                    String name = counts[2];
                    uploadSuccessData(name);
                    break;
                case 1:
                    if (convertDataInfo.size() == 0 &&
                            convertDataTnb.size() == 0 &&
                            convertDataFjhBaseInfo.size() == 0 &&
                            convertDataFjhFollowUpInfo.size() == 0 &&
                            convertDataGXB.size() == 0 &&
                            convertDataNCZ.size() == 0 &&
                            convertDataGxy.size() == 0 &&
                            convertDataJktj.size() == 0 &&
                            convertDataLnrzyy.size() == 0 &&
                            convertDataLnrzlnl.size() == 0 &&
                            convertDataXSRFS.size() == 0 &&
                            convertDataOneMonth.size() == 0 &&
                            convertDataThreeMonth.size() == 0 &&
                            convertDataSixMonth.size() == 0 &&
                            convertData8Month.size() == 0 &&
                            convertData12Month.size() == 0 &&
                            convertData18Month.size() == 0 &&
                            convertData24Month.size() == 0 &&
                            convertData30Month.size() == 0 &&
                            convertData3Year.size() == 0 &&
                            convertData4Year.size() == 0 &&
                            convertData5Year.size() == 0 &&
                            convertData6Year.size() == 0 &&
                            convertDataTheFirstTimePrenatalVisit.size() == 0 &&
                            convertData2TimesPrenatalVisits.size() == 0 &&
                            convertData3TimesPrenatalVisits.size() == 0 &&
                            convertData4TimesPrenatalVisits.size() == 0 &&
                            convertData5TimesPrenatalVisits.size() == 0 &&
                            convertDataMaternalPostnatalVisits.size() == 0 &&
                            convertDataMaternalFortyTwoDaysVisits.size() == 0 &&
                            converJsjbInfo.size() == 0 &&
                            converJsjbsfb.size() == 0 &&
                            pictures.size() == 0 &&
                            contsQyyh.size() == 0 &&
                            evaluates.size() == 0&&
                            lvYueFuWuBeans.size()==0&&
                            feiXinBingFollowups.size()==0&&
                            leiFengShiFollowups.size()==0&&
                            manZuFeiFollowups.size()==0&&
                            fengShiBingFollowups.size()==0) {
//                        showTextDialog("无数据可上传");
                        return;
                    }

                    upNextData(ModuleName.UPLOAD_SELFINFO);
                    break;
                case 2:
                    if (contsQyyh.size() == 0 && evaluates.size() == 0) {
//                        showTextDialog("无数据可上传");
                        return;
                    }
                    if (contsQyyh != null && contsQyyh.size() > 0) {
                        upDataQYYH();
                    } else if (evaluates != null && evaluates.size() > 0) {
                        upDataFWMYD();
                    }
                    break;
            }
        }
    };

    public void successUd(String name) {
//        cancelProgressDialog();
//        showTextDialog(name + "上传完成," + "  成功：" + s + "  失败：" + f);
        Log.e("**********", name + "上传完成" + "成功：" + s + "失败：" + f);
        s = 0;
        f = 0;
        if (ModuleName.UPLOAD_PHOTO.equals(name)){
            isUploadPicture = true;
        }
    }

    /**
     * 数据上传成功之后执行操作
     *
     * @param name
     */
    private void uploadSuccessData(String name) {
        if (ModuleName.UPLOAD_SELFINFO.equals(name)) {
            if (convertDataInfo != null && convertDataInfo.size() > 0) {
                upDataJBXX();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_TNB);
            }
        } else if (ModuleName.UPLOAD_TNB.equals(name)) {
            if (convertDataTnb != null && convertDataTnb.size() > 0) {
                upDataTNB();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_TNB_DYCSF);
            }
        } else if (ModuleName.UPLOAD_TNB_DYCSF.equals(name)) {
            /*肺结核第一次随访*/
            if (convertDataFjhBaseInfo != null && convertDataFjhBaseInfo.size() > 0) {
                upDataFjhDycsf();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_TNB_SFXX);
            }
        } else if (ModuleName.UPLOAD_TNB_SFXX.equals(name)) {
            /*肺结核随访信息*/
            if (convertDataFjhFollowUpInfo != null && convertDataFjhFollowUpInfo.size() > 0) {
                upDataFjhSfxx();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_NCZ);
            }
        } else if (ModuleName.UPLOAD_NCZ.equals(name)) {
            if (convertDataNCZ != null && convertDataNCZ.size() > 0) {
                updateNCZ();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_GXB);
            }
        } else if (ModuleName.UPLOAD_GXB.equals(name)) {
            if (convertDataGXB != null && convertDataGXB.size() > 0) {
                updateGXB();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_GXY);
            }
        } else if (ModuleName.UPLOAD_GXY.equals(name)) {
            if (convertDataGxy != null && convertDataGxy.size() > 0) {
                updateGXY();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_HEALTH_EXAMINATION);
            }
        } else if (ModuleName.UPLOAD_HEALTH_EXAMINATION.equals(name)) {
            if (convertDataJktj != null && convertDataJktj.size() > 0) {
                updaTaJKTJ();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_ELDERLY_MEDICINE);
            }
        } else if (ModuleName.UPLOAD_ELDERLY_MEDICINE.equals(name)) {
            if (convertDataLnrzyy != null && convertDataLnrzyy.size() > 0) {
                upDataLNRZYY();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_ELDERLY_SELFCARE_ABILITY);
            }
        } else if (ModuleName.UPLOAD_ELDERLY_SELFCARE_ABILITY.equals(name)) {
            if (convertDataLnrzlnl != null && convertDataLnrzlnl.size() > 0) {
                upDataLNRZLNL();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_NEWBORN_VISITS);
            }
        } else if (ModuleName.UPLOAD_CHILD_NEWBORN_VISITS.equals(name)) {
            if (convertDataXSRFS != null && convertDataXSRFS.size() > 0) {
                upDataXSEFS();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_1MONTH_AGE_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_1MONTH_AGE_VISIT.equals(name)) {
            if (convertDataOneMonth != null && convertDataOneMonth.size() > 0) {
                upDataMYLET();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_3MONTH_AGE_VISIT);
            }

        } else if (ModuleName.UPLOAD_CHILD_3MONTH_AGE_VISIT.equals(name)) {
            if (convertDataThreeMonth != null && convertDataThreeMonth.size() > 0) {
                upDataSYLET();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_6MONTH_AGE_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_6MONTH_AGE_VISIT.equals(name)) {
            if (convertDataSixMonth != null && convertDataSixMonth.size() > 0) {
                upDataLYLET();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_8MONTH_AGE_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_8MONTH_AGE_VISIT.equals(name)) {
            if (convertData8Month != null && convertData8Month.size() > 0) {
                upDataBYLET();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_12MONTH_AGE_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_12MONTH_AGE_VISIT.equals(name)) {
            /*12月龄儿童家庭访视*/
            if (convertData12Month != null && convertData12Month.size() > 0) {
                upDataSeLet();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_18MONTH_AGE_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_18MONTH_AGE_VISIT.equals(name)) {
            /*18月龄儿童家庭访视*/
            if (convertData18Month != null && convertData18Month.size() > 0) {
                upDataSbLet();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_24MONTH_AGE_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_24MONTH_AGE_VISIT.equals(name)) {
            /*24月龄儿童家庭访视*/
            if (convertData24Month != null && convertData24Month.size() > 0) {
                upDataEsLet();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_30MONTH_AGE_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_30MONTH_AGE_VISIT.equals(name)) {
            /*30月龄儿童家庭访视*/
            if (convertData30Month != null && convertData30Month.size() > 0) {
                upDataSsLet();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_3YEAR_HOME_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_3YEAR_HOME_VISIT.equals(name)) {
            /*3岁儿童家庭访视*/
            if (convertData3Year != null && convertData3Year.size() > 0) {
                upData3YearVisitInfo();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_4YEAR_HOME_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_4YEAR_HOME_VISIT.equals(name)) {
            /*4岁儿童家庭访视*/
            if (convertData4Year != null && convertData4Year.size() > 0) {
                upData4YearVisitInfo();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_5YEAR_HOME_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_5YEAR_HOME_VISIT.equals(name)) {
            /*5岁儿童家庭访视*/
            if (convertData5Year != null && convertData5Year.size() > 0) {
                upData5YearVisitInfo();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_CHILD_6YEAR_HOME_VISIT);
            }
        } else if (ModuleName.UPLOAD_CHILD_6YEAR_HOME_VISIT.equals(name)) {
            /*6岁儿童家庭访视*/
            if (convertData6Year != null && convertData6Year.size() > 0) {
                upData6YearVisitInfo();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PREGNANT_1TIMES_PRENATAL_VISIT);
            }
        } else if (ModuleName.UPLOAD_PREGNANT_1TIMES_PRENATAL_VISIT.equals(name)) {
            /*第一次产前访视*/
            if (convertDataTheFirstTimePrenatalVisit != null && convertDataTheFirstTimePrenatalVisit.size() > 0) {
                upDataFirstPrenatalVisit();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PREGNANT_2TIMES_PRENATAL_VISIT);

            }
        } else if (ModuleName.UPLOAD_PREGNANT_2TIMES_PRENATAL_VISIT.equals(name)) {
            /* 第二次产前访视*/
            if (convertData2TimesPrenatalVisits != null && convertData2TimesPrenatalVisits.size() > 0) {
                upDataSecondPrenatalVisits();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PREGNANT_3TIMES_PRENATAL_VISIT);

            }
        } else if (ModuleName.UPLOAD_PREGNANT_3TIMES_PRENATAL_VISIT.equals(name)) {
            /* 第三次产前访视*/
            if (convertData3TimesPrenatalVisits != null && convertData3TimesPrenatalVisits.size() > 0) {
                upDataThirdPrenatalVisits();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PREGNANT_4TIMES_PRENATAL_VISIT);

            }
        } else if (ModuleName.UPLOAD_PREGNANT_4TIMES_PRENATAL_VISIT.equals(name)) {
            /* 第四次产前访视*/
            if (convertData4TimesPrenatalVisits != null && convertData4TimesPrenatalVisits.size() > 0) {
                upDataFourTimesPrenatalVisits();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PREGNANT_5TIMES_PRENATAL_VISIT);

            }
        } else if (ModuleName.UPLOAD_PREGNANT_5TIMES_PRENATAL_VISIT.equals(name)) {
            /* 第五次产前访视*/
            if (convertData5TimesPrenatalVisits != null && convertData5TimesPrenatalVisits.size() > 0) {
                upDataFiveTimesPrenatalVisits();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PREGNANT_MATERNAL_POSTNATAL_VISITS);

            }
        } else if (ModuleName.UPLOAD_PREGNANT_MATERNAL_POSTNATAL_VISITS.equals(name)) {
            /* 孕产妇产后访视*/
            if (convertDataMaternalPostnatalVisits != null && convertDataMaternalPostnatalVisits.size() > 0) {
                upDataPostnatalVisitsPrenatalVisits();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PREGNANT_MATERNAL_42DAYS_VISITS);

            }
        } else if (ModuleName.UPLOAD_PREGNANT_MATERNAL_42DAYS_VISITS.equals(name)) {
            /* 孕产妇产后42天健康检查*/
            if (convertDataMaternalFortyTwoDaysVisits != null && convertDataMaternalFortyTwoDaysVisits.size() > 0) {
                upData42DaysPrenatalVisits();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_JSJB_BASEINFO);

            }
        } else if (ModuleName.UPLOAD_JSJB_BASEINFO.equals(name)) {
            if (converJsjbInfo != null && converJsjbInfo.size() > 0) {
                updateJSJBInfo();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_JSJB_FOLLOWUP);

            }
        } else if (ModuleName.UPLOAD_JSJB_FOLLOWUP.equals(name)) {
            if (converJsjbsfb != null && converJsjbsfb.size() > 0) {
                updateJSJBSF();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_QYYH);

            }
        } else if (ModuleName.UPLOAD_QYYH.equals(name)) {
            if (contsQyyh != null && contsQyyh.size() > 0) {
                upDataQYYH();
            } else {
                pictures = NovaApplication.fdbmanger.findAllByWhere(JTYS_SignPictureData.class,
                        "createrId='" + SPUtil.getstr_jdrusername(context) + "' AND isUpdate ='Y'");
                List<JTYS_SignPictureData> pictures1 = NovaApplication.fdbmanger.findAllByWhere(JTYS_SignPictureData.class,
                        "createrId='" + SPUtil.getStr_jdrno(context) + "' AND isUpdate ='Y'");
                if(pictures1.size()>0){
                    pictures.addAll(pictures1);
                }
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_FWMYD);

            }
        } else if (ModuleName.UPLOAD_FWMYD.equals(name)) {
            if (evaluates != null && evaluates.size() > 0) {
                upDataFWMYD();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_PHOTO);
            }
        } else if (ModuleName.UPLOAD_PHOTO.equals(name)) {
            List<JTYS_SignPictureData> pictures1 = NovaApplication.fdbmanger.findAllByWhere(JTYS_SignPictureData.class,
                    "createrId='" + SPUtil.getstr_jdrusername(context) + "' AND isUpdate ='Y'");
            List<JTYS_SignPictureData> pictures2 = NovaApplication.fdbmanger.findAllByWhere(JTYS_SignPictureData.class,
                    "createrId='" + SPUtil.getStr_jdrno(context) + "' AND isUpdate ='Y'");
            if(pictures2.size()>0){
                pictures1.addAll(pictures2);
            }
            if (pictures != null && pictures.size() > 0 && !isUploadPicture) {
                upDataPhoto();
                count++;
                if (count == pictures1.size()){
                    successUd(name);
                    count = 0;
                    return;
                }
            } else {
                successUd(name);
                upNextData(ModuleName.UPLOAD_LVYUEJL);
            }
        }else if(ModuleName.UPLOAD_LVYUEJL.equals(name)){
            if (lvYueFuWuBeans != null && lvYueFuWuBeans.size() > 0) {
                upDataLvYueJL();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPLOAD_FEIXINBING);

            }
        }
        else if(ModuleName.UPLOAD_FEIXINBING.equals(name)){
            if (feiXinBingFollowups != null && feiXinBingFollowups.size() > 0) {
                updateFeiXinBing();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPDATE_LEIFENGSHI);

            }
        }else if(ModuleName.UPDATE_LEIFENGSHI.equals(name)){
            if (leiFengShiFollowups != null && leiFengShiFollowups.size() > 0) {
                updateLeiFengshi();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPDATE_MANZUFEI);

            }
        }else if(ModuleName.UPDATE_MANZUFEI.equals(name)){
            if (manZuFeiFollowups != null && manZuFeiFollowups.size() > 0) {
                updateManZuFei();
            } else {
                successUd(name);
//                            uploadOtherData();
                upNextData(ModuleName.UPDATE_FENGSHIBING);

            }
        }else if(ModuleName.UPDATE_FENGSHIBING.equals(name)){
            if (fengShiBingFollowups != null && fengShiBingFollowups.size() > 0) {
                updateFengShiBing();
            } else {
                successUd(name);
//                            uploadOtherData();
//                upNextData(ModuleName.UPDATE_FENGSHIBING);

            }
        }
    }


    /**
     * 设置截取长度【分批数据上传】
     */
    private static final int subSize = 10;
    private int count = 0;//标识上传次数

    /**
     * 进行数据上传
     */
    private void upNextData(String type) {
        switch (type) {
            case ModuleName.UPLOAD_SELFINFO:
                //个人基本信息：
                if (convertDataInfo != null && convertDataInfo.size() > 0) {
                    upDataJBXX();
                    break;
                }
            case ModuleName.UPLOAD_TNB:
                //糖尿病：
                if (convertDataTnb != null && convertDataTnb.size() > 0) {
                    upDataTNB();
                    break;
                }
            case ModuleName.UPLOAD_TNB_DYCSF:
                //肺结核第一次随访：
                if (convertDataFjhBaseInfo != null && convertDataFjhBaseInfo.size() > 0) {
                    upDataFjhDycsf();
                    break;
                }
            case ModuleName.UPLOAD_TNB_SFXX:
                //肺结核随访信息：
                if (convertDataFjhFollowUpInfo != null && convertDataFjhFollowUpInfo.size() > 0) {
                    upDataFjhSfxx();
                    break;
                }
            case ModuleName.UPLOAD_NCZ:
                //脑卒中
                if (convertDataNCZ != null && convertDataNCZ.size() > 0) {
                    updateNCZ();
                    break;
                }
            case ModuleName.UPLOAD_GXB:
                //冠心病：
                if (convertDataGXB != null && convertDataGXB.size() > 0) {
                    updateGXB();
                    break;
                }

            case ModuleName.UPLOAD_GXY:
                //高血压：
                if (convertDataGxy != null && convertDataGxy.size() > 0) {
                    updateGXY();
                    break;
                }
            case ModuleName.UPLOAD_HEALTH_EXAMINATION:
                //健康体检
                if (convertDataJktj != null && convertDataJktj.size() > 0) {
                    updaTaJKTJ();
                    break;
                }
            case ModuleName.UPLOAD_ELDERLY_MEDICINE:
                //老年人中医体质
                if (convertDataLnrzyy != null && convertDataLnrzyy.size() > 0) {
                    upDataLNRZYY();
                    break;
                }
            case ModuleName.UPLOAD_ELDERLY_SELFCARE_ABILITY:
                //老年人自理能力
                if (convertDataLnrzlnl != null && convertDataLnrzlnl.size() > 0) {
                    upDataLNRZLNL();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_NEWBORN_VISITS:
                //新生儿访视
                if (convertDataXSRFS != null && convertDataXSRFS.size() > 0) {
                    upDataXSEFS();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_1MONTH_AGE_VISIT:
                //满月龄儿童访视
                if (convertDataOneMonth != null && convertDataOneMonth.size() > 0) {
                    upDataMYLET();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_3MONTH_AGE_VISIT:
                //三月龄儿童访视
                if (convertDataThreeMonth != null && convertDataThreeMonth.size() > 0) {
                    upDataSYLET();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_6MONTH_AGE_VISIT:
                //六月龄儿童访视
                if (convertDataSixMonth != null && convertDataSixMonth.size() > 0) {
                    upDataLYLET();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_8MONTH_AGE_VISIT:
                //8月龄儿童访视
                if (convertData8Month != null && convertData8Month.size() > 0) {
                    upDataBYLET();
                    break;
                }
            case ModuleName.UPLOAD_CHILD_12MONTH_AGE_VISIT:
                //12月龄儿童家庭访视
                if (convertData12Month != null && convertData12Month.size() > 0) {
                    upDataSeLet();
                    break;
                }


            case ModuleName.UPLOAD_CHILD_18MONTH_AGE_VISIT:
                //18月龄儿童家庭访视
                if (convertData18Month != null && convertData18Month.size() > 0) {
                    upDataSbLet();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_24MONTH_AGE_VISIT:
                //24月龄儿童家庭访视
                if (convertData24Month != null && convertData24Month.size() > 0) {
                    upDataEsLet();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_30MONTH_AGE_VISIT:
                //30月龄儿童家庭访视
                if (convertData30Month != null && convertData30Month.size() > 0) {
                    upDataSsLet();
                    break;
                }
            case ModuleName.UPLOAD_CHILD_3YEAR_HOME_VISIT:
                //3岁儿童家庭访视
                if (convertData3Year != null && convertData3Year.size() > 0) {
                    upData3YearVisitInfo();
                    break;
                }
            case ModuleName.UPLOAD_CHILD_4YEAR_HOME_VISIT:
                //4岁儿童家庭访视
                if (convertData4Year != null && convertData4Year.size() > 0) {
                    upData4YearVisitInfo();
                    break;
                }
            case ModuleName.UPLOAD_CHILD_5YEAR_HOME_VISIT:
                //5岁儿童家庭访视
                if (convertData5Year != null && convertData5Year.size() > 0) {
                    upData5YearVisitInfo();
                    break;
                }

            case ModuleName.UPLOAD_CHILD_6YEAR_HOME_VISIT:
                //6岁儿童家庭访视
                if (convertData6Year != null && convertData6Year.size() > 0) {
                    upData6YearVisitInfo();
                    break;
                }
            case ModuleName.UPLOAD_PREGNANT_1TIMES_PRENATAL_VISIT:
                /* 第一次产前访视*/
                if (convertDataTheFirstTimePrenatalVisit != null && convertDataTheFirstTimePrenatalVisit.size() > 0) {
                    upDataFirstPrenatalVisit();
                    break;
                }
            case ModuleName.UPLOAD_PREGNANT_2TIMES_PRENATAL_VISIT:
                /* 第二次产前访视*/
                if (convertData2TimesPrenatalVisits != null && convertData2TimesPrenatalVisits.size() > 0) {
                    upDataSecondPrenatalVisits();
                    break;
                }
            case ModuleName.UPLOAD_PREGNANT_3TIMES_PRENATAL_VISIT:
                /* 第三次产前访视*/
                if (convertData3TimesPrenatalVisits != null && convertData3TimesPrenatalVisits.size() > 0) {
                    upDataThirdPrenatalVisits();
                    break;
                }
            case ModuleName.UPLOAD_PREGNANT_4TIMES_PRENATAL_VISIT:
                /* 第四次产前访视*/
                if (convertData4TimesPrenatalVisits != null && convertData4TimesPrenatalVisits.size() > 0) {
                    upDataFourTimesPrenatalVisits();
                    break;
                }
            case ModuleName.UPLOAD_PREGNANT_5TIMES_PRENATAL_VISIT:
                /* 第五次产前访视*/
                if (convertData5TimesPrenatalVisits != null && convertData5TimesPrenatalVisits.size() > 0) {
                    upDataFiveTimesPrenatalVisits();
                    break;
                }
            case ModuleName.UPLOAD_PREGNANT_MATERNAL_POSTNATAL_VISITS:
                /* 孕产妇产后访视*/
                if (convertDataMaternalPostnatalVisits != null && convertDataMaternalPostnatalVisits.size() > 0) {
                    upDataPostnatalVisitsPrenatalVisits();
                    break;
                }
            case ModuleName.UPLOAD_PREGNANT_MATERNAL_42DAYS_VISITS:
                /* 孕产妇产后42天健康检查*/
                if (convertDataMaternalFortyTwoDaysVisits != null && convertDataMaternalFortyTwoDaysVisits.size() > 0) {
                    upData42DaysPrenatalVisits();
                    break;
                }
            case ModuleName.UPLOAD_JSJB_BASEINFO:
                /* 精神病基本信息*/
                if (converJsjbInfo != null && converJsjbInfo.size() > 0) {
                    updateJSJBInfo();
                    break;
                }
            case ModuleName.UPLOAD_JSJB_FOLLOWUP:
                /* 精神病随访*/
                if (converJsjbsfb != null && converJsjbsfb.size() > 0) {
                    updateJSJBSF();
                    break;
                }
            case ModuleName.UPLOAD_QYYH:
                /* 签约用户*/
                if (contsQyyh != null && contsQyyh.size() > 0) {
                    upDataQYYH();
                    break;
                }
            case ModuleName.UPLOAD_FWMYD:
                /* 服务满意度用户*/
                if (evaluates != null && evaluates.size() > 0) {
                    upDataFWMYD();
                    break;
                }
            case ModuleName.UPLOAD_PHOTO:
                /* 照片*/
                if (pictures != null && pictures.size() > 0) {
                    upDataPhoto();
                    break;
                }
            case ModuleName.UPLOAD_LVYUEJL:
                if(lvYueFuWuBeans!=null&&lvYueFuWuBeans.size()>0){
                    upDataLvYueJL();
                    break;
                }
            case ModuleName.UPLOAD_FEIXINBING:
                if(feiXinBingFollowups!=null&&feiXinBingFollowups.size()>0){
                    updateFeiXinBing();
                    break;
                }
            case ModuleName.UPDATE_LEIFENGSHI:
                if(leiFengShiFollowups!=null&&leiFengShiFollowups.size()>0){
                    updateLeiFengshi();
                    break;
                }
            case ModuleName.UPDATE_FENGSHIBING:
                if(fengShiBingFollowups!=null&&fengShiBingFollowups.size()>0){
                    updateFengShiBing();
                    break;
                }
            case ModuleName.UPDATE_MANZUFEI:
                if(manZuFeiFollowups!=null&&manZuFeiFollowups.size()>0){
                    updateManZuFei();
                    break;
                }
            default:
                break;

        }
    }

    /**
     * 履约记录上传
     */
    public void  upDataLvYueJL(){
        List list = new ArrayList<>();
        // 服务满意度
        List<LvYueFuWuBean> newList = null;

        if (lvYueFuWuBeans.size() > subSize) {
            newList = lvYueFuWuBeans.subList(0, subSize);
            lvYueFuWuBeans = lvYueFuWuBeans.subList(subSize, lvYueFuWuBeans.size());
            Log.e("*************", newList.size() + "***" + lvYueFuWuBeans.size() + "*******************");
        } else {
            newList = lvYueFuWuBeans;
            lvYueFuWuBeans = null;
        }
        for(LvYueFuWuBean lvYueFuWuBean:newList){
            if(!TextUtils.isEmpty(lvYueFuWuBean.getHuanQianMingStr())){
                Log.e("患者签名地址",lvYueFuWuBean.getHuanQianMingStr());
                lvYueFuWuBean.setHuanQianMingStr(ImageTools.imageURLToString(lvYueFuWuBean.getHuanQianMingStr()));
            }
            if(!TextUtils.isEmpty(lvYueFuWuBean.getDocQianMingStr())){
                Log.e("医生签名地址",lvYueFuWuBean.getDocQianMingStr());
                lvYueFuWuBean.setDocQianMingStr(ImageTools.imageURLToString(lvYueFuWuBean.getDocQianMingStr()));
            }
            lvYueFuWuBean.setCardNum(TextUtils.isEmpty(lvYueFuWuBean.getCardNum()) ? "" : lvYueFuWuBean.getCardNum().toUpperCase());

        }

        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPLOAD_LVYUEJL, JX_UploadData.TYPE_LVYUEJL, "HyperJson",
                "addPerformance", "", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 类风湿数据上传
     */
    public void updateLeiFengshi(){
        List list = new ArrayList<>();
        List<LeiFengShi> newList = null;
        if (leiFengShiFollowups.size() > subSize) {
            newList = leiFengShiFollowups.subList(0, subSize);
            leiFengShiFollowups = leiFengShiFollowups.subList(subSize, leiFengShiFollowups.size());
        } else {
            newList = leiFengShiFollowups;
            leiFengShiFollowups = null;
        }


        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPDATE_LEIFENGSHI, JX_UploadData.TYPE_LEIFENGSHI, "LfsJson",
                "addLfs", "", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();


    }

    /**
     * 肺心病数据上传
     */
    public void updateFeiXinBing(){
        List list = new ArrayList<>();
        List<FeiXinBing> newList = null;
        if (feiXinBingFollowups.size() > subSize) {
            newList = feiXinBingFollowups.subList(0, subSize);

            feiXinBingFollowups = feiXinBingFollowups.subList(subSize, feiXinBingFollowups.size());
        } else {
            newList = feiXinBingFollowups;
            feiXinBingFollowups = null;
        }


        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPLOAD_FEIXINBING, JX_UploadData.TYPE_FEIXINBING, "FxbJson",
                "addFxb", "", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();


    }
    /**
     *风湿病数据上传
     */
    public void updateFengShiBing(){
        List list = new ArrayList<>();
        List<FengShiBing> newList = null;
        if (fengShiBingFollowups.size() > subSize) {
            newList = fengShiBingFollowups.subList(0, subSize);
            fengShiBingFollowups = fengShiBingFollowups.subList(subSize, fengShiBingFollowups.size());
        } else {
            newList = fengShiBingFollowups;
            fengShiBingFollowups = null;
        }


        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPDATE_FENGSHIBING, JX_UploadData.TYPE_FENGSHIBING, "FsbJson",
                "addFsb", "", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();


    }

    /**
     *慢阻肺数据上传
     */
    public void updateManZuFei(){
        List list = new ArrayList<>();
        List<ManZuFei> newList = null;
        if (manZuFeiFollowups.size() > subSize) {
            newList = manZuFeiFollowups.subList(0, subSize);
            manZuFeiFollowups = manZuFeiFollowups.subList(subSize, manZuFeiFollowups.size());
        } else {
            newList = manZuFeiFollowups;
            manZuFeiFollowups = null;
        }


        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPDATE_MANZUFEI, JX_UploadData.TYPE_MANZUFEI, "MzfJson",
                "addMzf", "", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();


    }

    private void upDataPhoto() {
        List list = new ArrayList<>();
        List<JTYS_SignPictureData> newList = null;
        if (pictures.size() > 0) {
            newList = pictures.subList(0, 1);
            pictures = pictures.subList(1, pictures.size());
        } else {
            newList = pictures;
            pictures = null;
        }

        UploadDataBean udb9 = new UploadDataBean("照片", JX_UploadData.TYPE_PICTURE, "json", "uploadFile", "", newList);
        list.add(udb9);
        final ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        new Thread(new Runnable() {
            @Override
            public void run() {
                Looper.prepare();
                uld.uploadDatas();
                Looper.loop();
            }
        }).start();
    }

    /**
     * 签约用户
     */
    public void upDataQYYH() {

        List list = new ArrayList<>();
        // 签约用户
        List<QyinfoUploadBean> newList = null;

        if (contsQyyh.size() > subSize) {
            newList = contsQyyh.subList(0, subSize);
            contsQyyh = contsQyyh.subList(subSize, contsQyyh.size());
            Log.e("*******upDataQYYH******", newList.size() + "***" + contsQyyh.size() + "*******************");
        } else {
            newList = contsQyyh;
            contsQyyh = null;
        }

        UploadDataBean udb1 = new UploadDataBean(ModuleName.UPLOAD_QYYH, JX_UploadData.TYPE_QYYH, "jsonkey",
                "addCustomerDoctorCont", "", newList);
        list.add(udb1);
//
        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 服务满意度
     */
    public void upDataFWMYD() {

        List list = new ArrayList<>();
        // 服务满意度
        List<JTYSDoctorEvaluateBean> newList = null;

        if (evaluates.size() > subSize) {
            newList = evaluates.subList(0, subSize);
            evaluates = evaluates.subList(subSize, evaluates.size());
            Log.e("*************", newList.size() + "***" + evaluates.size() + "*******************");
        } else {
            newList = evaluates;
            evaluates = null;
        }

        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPLOAD_FWMYD, JX_UploadData.TYPE_FWMYD, "ServiceSatisJson",
                "addServiceSatis", "", newList);
        list.add(udb2);
//
        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 随访表上传完 之后调用一次
     */
    private void sendFollowTable() {
//        String doctorId = SPUtils.getInstance().getString(HttpConstant._DOCTOR_ID,"");
        Log.e("当前医生", NovaApplication.getJgrno());

        RxHttp.postForm(HttpConstant.sendFollowTable + NovaApplication.getJgrno())
                .asString()
                .subscribe(resultBean -> {
                    Log.e("xiaoxin", "sendFollowTable: 11" );
                }, throwable -> {
                    Log.e("xiaoxin", "sendFollowTable:22 " );
                });
    }

    /**
     * 基本信息
     */
    public void upDataJBXX() {
        List list = new ArrayList<>();
        // 个人基本信息
        List<HdPersonalInfo> newList = null;

        if (convertDataInfo.size() > subSize) {
            newList = convertDataInfo.subList(0, subSize);
            convertDataInfo = convertDataInfo.subList(subSize, convertDataInfo.size());
            Log.e("*************", newList.size() + "***" + convertDataInfo.size() + "*******************");
        } else {
            newList = convertDataInfo;
            convertDataInfo = null;
        }
        for (int i = 0, size = newList.size(); i < size; i++) {
            if (TextUtils.isEmpty(newList.get(i).getModified())) {
                newList.get(i).setModified(newList.get(i).getCreater());
            }
        }
        UploadDataBean udb1 = new UploadDataBean(ModuleName.UPLOAD_SELFINFO, JX_UploadData.TYPE_PERSONALINFO, "jsonStr",
                "addHdPersonalInfo", "grjbxx", newList);
        list.add(udb1);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 糖尿病
     */
    public void upDataTNB() {
        List list = new ArrayList<>();
        // 糖尿病
        List<Diabetes> newList = new ArrayList<>();

        for (Diabetes diabetes : newList){
            System.out.println("上传数据："+diabetes.getCardid());
        }
        if (convertDataTnb.size() > 10) {
            newList = convertDataTnb.subList(0, subSize);
            convertDataTnb = convertDataTnb.subList(subSize, convertDataTnb.size());
            Log.e("*************", newList.size() + "***" + convertDataTnb.size() + "*******************");
        } else {
            newList = convertDataTnb;
            convertDataTnb = null;
        }

        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPLOAD_TNB,
                JX_UploadData.TYPE_DIABETES, "TnbJson",
                "addTnb", "tnb", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 肺结核第一次随访
     */
    public void upDataFjhDycsf() {
        List list = new ArrayList<>();
        //肺结核第一次随访
        List<TuberculosisBaseInfo> newList = null;

        if (convertDataFjhBaseInfo.size() > 10) {
            newList = convertDataFjhBaseInfo.subList(0, subSize);
            convertDataFjhBaseInfo = convertDataFjhBaseInfo.subList(subSize, convertDataFjhBaseInfo.size());
            Log.e("*************", newList.size() + "***" + convertDataFjhBaseInfo.size() + "*******************");
        } else {
            newList = convertDataFjhBaseInfo;
            convertDataFjhBaseInfo = null;
        }

        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPLOAD_TNB_DYCSF,
                JX_UploadData.TYPE_TUBERCULOSIS_BASE_INFO, "TubJson",
                "addTubtoFirst", "tnb", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 肺结核随访信息
     */
    public void upDataFjhSfxx() {
        List list = new ArrayList<>();
        // 肺结核随访信息
        List<TuberculosisFollowUpInfo> newList = null;

        if (convertDataFjhFollowUpInfo.size() > 10) {
            newList = convertDataFjhFollowUpInfo.subList(0, subSize);
            convertDataFjhFollowUpInfo = convertDataFjhFollowUpInfo.subList(subSize, convertDataFjhFollowUpInfo.size());
            Log.e("*************", newList.size() + "***" + convertDataFjhFollowUpInfo.size() + "*******************");
        } else {
            newList = convertDataFjhFollowUpInfo;
            convertDataFjhFollowUpInfo = null;
        }

        UploadDataBean udb2 = new UploadDataBean(ModuleName.UPLOAD_TNB_SFXX,
                JX_UploadData.TYPE_TUBERCULOSIS_FOLLOW_INFO, "TbFollowJson",
                "addTbFollow", "tnb", newList);
        list.add(udb2);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 脑卒中
     */
    private void updateNCZ() {
        List list = new ArrayList<>();
        // 脑卒中
        List<HdDiseaseManageStroke> newList = null;

        if (convertDataNCZ.size() > subSize) {
            newList = convertDataNCZ.subList(0, subSize);
            convertDataNCZ = convertDataNCZ.subList(subSize, convertDataNCZ.size());
            Log.e("*************", newList.size() + "***" + convertDataNCZ.size() + "*******************");
        } else {
            newList = convertDataNCZ;
            convertDataNCZ = null;
        }
        UploadDataBean udb3 = new UploadDataBean(ModuleName.UPLOAD_NCZ,
                JX_UploadData.TYPE_CEREBRALSTROKE, "StrokeJson",
                "addStroke", "ncz", newList);
        list.add(udb3);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 冠心病
     */
    public void updateGXB() {
        List list = new ArrayList<>();
        // 冠心病
        List<CoronaryHeartDisease> newList = null;

        if (convertDataGXB.size() > subSize) {
            newList = convertDataGXB.subList(0, subSize);
            convertDataGXB = convertDataGXB.subList(subSize, convertDataGXB.size());
            Log.e("*************", newList.size() + "***" + convertDataGXB.size() + "*******************");
        } else {
            newList = convertDataGXB;
            convertDataGXB = null;
        }

        UploadDataBean udb3 = new UploadDataBean(ModuleName.UPLOAD_GXB,
                JX_UploadData.TYPE_CORONARYHEART, "coronaryJson",
                "addCoronary", "gxb", newList);
        list.add(udb3);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 高血压
     */
    public void updateGXY() {
        List list = new ArrayList<>();
        // 高血压
        List<Hypertensio> newList = null;

        if (convertDataGxy.size() > subSize) {
            newList = convertDataGxy.subList(0, subSize);
            convertDataGxy = convertDataGxy.subList(subSize, convertDataGxy.size());
            Log.e("*************", newList.size() + "***" + convertDataGxy.size() + "*******************");
        } else {
            newList = convertDataGxy;
            convertDataGxy = null;
        }

        UploadDataBean udb3 = new UploadDataBean(ModuleName.UPLOAD_GXY,
                JX_UploadData.TYPE_HYPERTENSION, "HyperJson",
                "addHypertension", "gxy", newList);
        list.add(udb3);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 健康体检
     */
    public void updaTaJKTJ() {
        List list = new ArrayList<>();
        // 健康体检
        List<HealthCheck> newList = null;

        if (convertDataJktj.size() > 10) {
            newList = convertDataJktj.subList(0, subSize);
            convertDataJktj = convertDataJktj.subList(subSize, convertDataJktj.size());
            Log.e("*************", newList.size() + "***" + convertDataJktj.size() + "*******************");
        } else {
            newList = convertDataJktj;
            convertDataJktj = null;
        }

        UploadDataBean udb4 = new UploadDataBean(ModuleName.UPLOAD_HEALTH_EXAMINATION,
                JX_UploadData.TYPE_HEALTHCHECK, "JktjAllJson",
                "addJktjAll", "jktj", newList);
        list.add(udb4);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 老年人中医药
     */
    public void upDataLNRZYY() {
        List list = new ArrayList<>();
        // 老年人中医药
        List<OldPhysique> newList = null;

        if (convertDataLnrzyy.size() > subSize) {
            newList = convertDataLnrzyy.subList(0, subSize);
            convertDataLnrzyy = convertDataLnrzyy.subList(subSize, convertDataLnrzyy.size());
            Log.e("*************", newList.size() + "***" + convertDataLnrzyy.size() + "*******************");
        } else {
            newList = convertDataLnrzyy;
            convertDataLnrzyy = null;
        }

        UploadDataBean udb5 = new UploadDataBean(ModuleName.UPLOAD_ELDERLY_MEDICINE,
                JX_UploadData.TYPE_OLD_PHYSIQUE,
                "OldPhysiqueJson", "addOldPhysique", "oldPhysic",
                newList);
        list.add(udb5);
        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 老年人自理能力
     */
    public void upDataLNRZLNL() {
        List list = new ArrayList<>();
        // 老年人自理能力
        List<OldSelfHelp> newList = null;

        if (convertDataLnrzlnl.size() > subSize) {
            newList = convertDataLnrzlnl.subList(0, subSize);
            convertDataLnrzlnl = convertDataLnrzlnl.subList(subSize, convertDataLnrzlnl.size());
            Log.e("*************", newList.size() + "***" + convertDataLnrzlnl.size() + "*******************");
        } else {
            newList = convertDataLnrzlnl;
            convertDataLnrzlnl = null;
        }

        UploadDataBean udb6 = new UploadDataBean(ModuleName.UPLOAD_ELDERLY_SELFCARE_ABILITY,
                JX_UploadData.TYPE_OLD_SELF_HELP,
                "OlsSelfHelpJson", "addOldSelfHelp", "oldself",
                newList);
        list.add(udb6);
        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 第一次产前访视
     */
    public void upDataFirstPrenatalVisit() {
        List list = new ArrayList<>();
        // 第一次产前访视
        List<FirstPrenatalVisit> newList = null;

        if (convertDataTheFirstTimePrenatalVisit.size() > subSize) {
            newList = convertDataTheFirstTimePrenatalVisit.subList(0, subSize);
            convertDataTheFirstTimePrenatalVisit = convertDataTheFirstTimePrenatalVisit.subList(subSize, convertDataTheFirstTimePrenatalVisit.size());
            Log.e("*************", newList.size() + "***" + convertDataTheFirstTimePrenatalVisit.size() + "*******************");
        } else {
            newList = convertDataTheFirstTimePrenatalVisit;
            convertDataTheFirstTimePrenatalVisit = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_PREGNANT_1TIMES_PRENATAL_VISIT,
                JX_UploadData.TYPE_1TIMES,
                "jsonkey", "addFirstvisit", "",
                newList);
        list.add(udb12);
        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 第2次产前随访
     */
    public void upDataSecondPrenatalVisits() {
        List list = new ArrayList<>();
        //第2次产前随访
        List<SecondToFifthPrenatalVisits> newList = null;

        if (convertData2TimesPrenatalVisits.size() > subSize) {
            newList = convertData2TimesPrenatalVisits.subList(0, subSize);
            convertData2TimesPrenatalVisits = convertData2TimesPrenatalVisits.subList(subSize, convertData2TimesPrenatalVisits.size());
            Log.e("*************", newList.size() + "***" + convertData2TimesPrenatalVisits.size() + "*******************");
        } else {
            newList = convertData2TimesPrenatalVisits;
            convertData2TimesPrenatalVisits = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_PREGNANT_2TIMES_PRENATAL_VISIT,
                JX_UploadData.TYPE_2TIMES,
                "jsonkey", "addTwoToFiveVisit", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 第3次产前随访
     */
    public void upDataThirdPrenatalVisits() {
        List list = new ArrayList<>();
        //第2次产前随访
        List<SecondToFifthPrenatalVisits> newList = null;

        if (convertData3TimesPrenatalVisits.size() > subSize) {
            newList = convertData3TimesPrenatalVisits.subList(0, subSize);
            convertData3TimesPrenatalVisits = convertData3TimesPrenatalVisits.subList(subSize, convertData3TimesPrenatalVisits.size());
            Log.e("*************", newList.size() + "***" + convertData3TimesPrenatalVisits.size() + "*******************");
        } else {
            newList = convertData3TimesPrenatalVisits;
            convertData3TimesPrenatalVisits = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_PREGNANT_3TIMES_PRENATAL_VISIT,
                JX_UploadData.TYPE_3TIMES,
                "jsonkey", "addTwoToFiveVisit", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 第4次产前随访
     */
    public void upDataFourTimesPrenatalVisits() {
        List list = new ArrayList<>();
        //第2次产前随访
        List<SecondToFifthPrenatalVisits> newList = null;

        if (convertData4TimesPrenatalVisits.size() > subSize) {
            newList = convertData4TimesPrenatalVisits.subList(0, subSize);
            convertData4TimesPrenatalVisits = convertData4TimesPrenatalVisits.subList(subSize, convertData4TimesPrenatalVisits.size());
            Log.e("*************", newList.size() + "***" + convertData4TimesPrenatalVisits.size() + "*******************");
        } else {
            newList = convertData4TimesPrenatalVisits;
            convertData4TimesPrenatalVisits = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_PREGNANT_4TIMES_PRENATAL_VISIT,
                JX_UploadData.TYPE_4TIMES,
                "jsonkey", "addTwoToFiveVisit", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 第5次产前随访
     */
    public void upDataFiveTimesPrenatalVisits() {
        List list = new ArrayList<>();
        //第5次产前随访
        List<SecondToFifthPrenatalVisits> newList = null;

        if (convertData5TimesPrenatalVisits.size() > subSize) {
            newList = convertData5TimesPrenatalVisits.subList(0, subSize);
            convertData5TimesPrenatalVisits = convertData5TimesPrenatalVisits.subList(subSize, convertData5TimesPrenatalVisits.size());
            Log.e("*************", newList.size() + "***" + convertData5TimesPrenatalVisits.size() + "*******************");
        } else {
            newList = convertData5TimesPrenatalVisits;
            convertData5TimesPrenatalVisits = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_PREGNANT_5TIMES_PRENATAL_VISIT,
                JX_UploadData.TYPE_5TIMES,
                "jsonkey", "addTwoToFiveVisit", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 孕产妇产后访视
     */
    public void upDataPostnatalVisitsPrenatalVisits() {
        List list = new ArrayList<>();
        //孕产妇产后访视
        List<MaternalPostnatalVisits> newList = null;

        if (convertDataMaternalPostnatalVisits.size() > subSize) {
            newList = convertDataMaternalPostnatalVisits.subList(0, subSize);
            convertDataMaternalPostnatalVisits = convertDataMaternalPostnatalVisits.subList(subSize, convertDataMaternalPostnatalVisits.size());
            Log.e("*************", newList.size() + "***" + convertDataMaternalPostnatalVisits.size() + "*******************");
        } else {
            newList = convertDataMaternalPostnatalVisits;
            convertDataMaternalPostnatalVisits = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_PREGNANT_MATERNAL_POSTNATAL_VISITS,
                JX_UploadData.TYPE_POSTNATAL_VISITS,
                "jsonkey", "addPostpartum", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 孕产妇产后42天健康检查
     */
    public void upData42DaysPrenatalVisits() {
        List list = new ArrayList<>();
        //孕产妇产后42天健康检查
        List<MaternalFortyTwoDaysVisits> newList = null;

        if (convertDataMaternalFortyTwoDaysVisits.size() > subSize) {
            newList = convertDataMaternalFortyTwoDaysVisits.subList(0, subSize);
            convertDataMaternalFortyTwoDaysVisits = convertDataMaternalFortyTwoDaysVisits.subList(subSize, convertDataMaternalFortyTwoDaysVisits.size());
            Log.e("*************", newList.size() + "***" + convertDataMaternalFortyTwoDaysVisits.size() + "*******************");
        } else {
            newList = convertDataMaternalFortyTwoDaysVisits;
            convertDataMaternalFortyTwoDaysVisits = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_PREGNANT_MATERNAL_42DAYS_VISITS,
                JX_UploadData.TYPE_42DAYS,
                "jsonkey", "add42Days", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 新生儿访视
     */
    public void upDataXSEFS() {
        List list = new ArrayList<>();
        // 新生儿访视
        List<ChildhealthNeonate> newList = null;

        if (convertDataXSRFS.size() > subSize) {
            newList = convertDataXSRFS.subList(0, subSize);
            convertDataXSRFS = convertDataXSRFS.subList(subSize, convertDataXSRFS.size());
            Log.e("*************", newList.size() + "***" + convertDataXSRFS.size() + "*******************");
        } else {
            newList = convertDataXSRFS;
            convertDataXSRFS = null;
        }

        UploadDataBean udb10 = new UploadDataBean(ModuleName.UPLOAD_CHILD_NEWBORN_VISITS,
                JX_UploadData.TYPE_XSRFS,
                "jsonkey", "addChildhealthNeonate", "",
                newList);
        list.add(udb10);
        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 满月龄儿童访视
     */
    public void upDataMYLET() {
        List list = new ArrayList<>();
        // 满月龄儿童访视
        List<ChildWithOneYearOld> newList = null;

        if (convertDataOneMonth.size() > subSize) {
            newList = convertDataOneMonth.subList(0, subSize);
            convertDataOneMonth = convertDataOneMonth.subList(subSize, convertDataOneMonth.size());
            Log.e("*************", newList.size() + "***" + convertDataOneMonth.size() + "*******************");
        } else {
            newList = convertDataOneMonth;
            convertDataOneMonth = null;
        }

        UploadDataBean udb11 = new UploadDataBean(ModuleName.UPLOAD_CHILD_1MONTH_AGE_VISIT,
                JX_UploadData.TYPE_XSRFS,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb11);
        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 三月龄儿童访视
     */
    public void upDataSYLET() {
        List list = new ArrayList<>();
        // 三月龄儿童访视
        List<ChildWithOneYearOld> newList = null;

        if (convertDataThreeMonth.size() > subSize) {
            newList = convertDataThreeMonth.subList(0, subSize);
            convertDataThreeMonth = convertDataThreeMonth.subList(subSize, convertDataThreeMonth.size());
            Log.e("*************", newList.size() + "***" + convertDataThreeMonth.size() + "*******************");
        } else {
            newList = convertDataThreeMonth;
            convertDataThreeMonth = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_3MONTH_AGE_VISIT,
                JX_UploadData.TYPE_THREEMONTH,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 六月龄儿童访视
     */
    public void upDataLYLET() {
        List list = new ArrayList<>();
        // 六月龄儿童访视
        List<ChildWithOneYearOld> newList = null;

        if (convertDataSixMonth.size() > subSize) {
            newList = convertDataSixMonth.subList(0, subSize);
            convertDataSixMonth = convertDataSixMonth.subList(subSize, convertDataSixMonth.size());
            Log.e("*************", newList.size() + "***" + convertDataSixMonth.size() + "*******************");
        } else {
            newList = convertDataSixMonth;
            convertDataSixMonth = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_6MONTH_AGE_VISIT,
                JX_UploadData.TYPE_SIXMONTH,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 八月龄儿童访视
     */
    public void upDataBYLET() {
        List list = new ArrayList<>();
        // 八月龄儿童访视
        List<ChildWithOneYearOld> newList = null;

        if (convertData8Month.size() > subSize) {
            newList = convertData8Month.subList(0, subSize);
            convertData8Month = convertData8Month.subList(subSize, convertData8Month.size());
            Log.e("*************", newList.size() + "***" + convertData8Month.size() + "*******************");
        } else {
            newList = convertData8Month;
            convertData8Month = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_8MONTH_AGE_VISIT,
                JX_UploadData.TYPE_EIGHTMONTH,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 12月龄儿童访视
     */
    public void upDataSeLet() {
        List list = new ArrayList<>();
        // 12月龄儿童访视
        List<MonthsChildHomeVisit> newList = null;

        if (convertData12Month.size() > subSize) {
            newList = convertData12Month.subList(0, subSize);
            convertData12Month = convertData12Month.subList(subSize, convertData12Month.size());
            Log.e("*************", newList.size() + "***" + convertData12Month.size() + "*******************");
        } else {
            newList = convertData12Month;
            convertData12Month = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_12MONTH_AGE_VISIT,
                JX_UploadData.TYPE_12MONTH,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 18月龄儿童访视
     */
    public void upDataSbLet() {
        List list = new ArrayList<>();
        // 18月龄儿童访视
        List<MonthsChildHomeVisit> newList = null;

        if (convertData18Month.size() > subSize) {
            newList = convertData18Month.subList(0, subSize);
            convertData18Month = convertData18Month.subList(subSize, convertData18Month.size());
            Log.e("*************", newList.size() + "***" + convertData18Month.size() + "*******************");
        } else {
            newList = convertData18Month;
            convertData18Month = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_18MONTH_AGE_VISIT,
                JX_UploadData.TYPE_18MONTH,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 24月龄儿童访视
     */
    public void upDataEsLet() {
        List list = new ArrayList<>();
        // 24月龄儿童访视
        List<MonthsChildHomeVisit> newList = null;

        if (convertData24Month.size() > subSize) {
            newList = convertData24Month.subList(0, subSize);
            convertData24Month = convertData24Month.subList(subSize, convertData24Month.size());
            Log.e("*************", newList.size() + "***" + convertData24Month.size() + "*******************");
        } else {
            newList = convertData24Month;
            convertData24Month = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_24MONTH_AGE_VISIT,
                JX_UploadData.TYPE_24MONTH,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 30月龄儿童访视
     */
    public void upDataSsLet() {
        List list = new ArrayList<>();
        // 30月龄儿童访视
        List<MonthsChildHomeVisit> newList = null;

        if (convertData30Month.size() > subSize) {
            newList = convertData30Month.subList(0, subSize);
            convertData30Month = convertData30Month.subList(subSize, convertData30Month.size());
            Log.e("*************", newList.size() + "***" + convertData30Month.size() + "*******************");
        } else {
            newList = convertData30Month;
            convertData30Month = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_30MONTH_AGE_VISIT,
                JX_UploadData.TYPE_30MONTH,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 3岁儿童访视
     */
    public void upData3YearVisitInfo() {
        List list = new ArrayList<>();
        /*  3岁儿童访视*/
        List<YearChildHomeVisit> newList = null;

        if (convertData3Year.size() > subSize) {
            newList = convertData3Year.subList(0, subSize);
            convertData3Year = convertData3Year.subList(subSize, convertData3Year.size());
            Log.e("*************", newList.size() + "***" + convertData3Year.size() + "*******************");
        } else {
            newList = convertData3Year;
            convertData3Year = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_3YEAR_HOME_VISIT,
                JX_UploadData.TYPE_3YEAR,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 4岁儿童访视
     */
    public void upData4YearVisitInfo() {
        List list = new ArrayList<>();
        /*4岁儿童访视*/
        List<YearChildHomeVisit> newList = null;

        if (convertData4Year.size() > subSize) {
            newList = convertData4Year.subList(0, subSize);
            convertData4Year = convertData4Year.subList(subSize, convertData4Year.size());
            Log.e("*************", newList.size() + "***" + convertData4Year.size() + "*******************");
        } else {
            newList = convertData4Year;
            convertData4Year = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_4YEAR_HOME_VISIT,
                JX_UploadData.TYPE_4YEAR,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 5岁儿童访视
     */
    public void upData5YearVisitInfo() {
        List list = new ArrayList<>();
        /*  5岁儿童访视*/
        List<YearChildHomeVisit> newList = null;

        if (convertData5Year.size() > subSize) {
            newList = convertData5Year.subList(0, subSize);
            convertData5Year = convertData5Year.subList(subSize, convertData5Year.size());
            Log.e("*************", newList.size() + "***" + convertData5Year.size() + "*******************");
        } else {
            newList = convertData5Year;
            convertData5Year = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_5YEAR_HOME_VISIT,
                JX_UploadData.TYPE_5YEAR,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 6岁儿童访视
     */
    public void upData6YearVisitInfo() {
        List list = new ArrayList<>();
        // 6岁儿童访视
        List<YearChildHomeVisit> newList = null;

        if (convertData6Year.size() > subSize) {
            newList = convertData6Year.subList(0, subSize);
            convertData6Year = convertData6Year.subList(subSize, convertData6Year.size());
            Log.e("*************", newList.size() + "***" + convertData6Year.size() + "*******************");
        } else {
            newList = convertData6Year;
            convertData6Year = null;
        }

        UploadDataBean udb12 = new UploadDataBean(ModuleName.UPLOAD_CHILD_6YEAR_HOME_VISIT,
                JX_UploadData.TYPE_6YEAR,
                "jsonkey", "addChildhealthChildren", "",
                newList);
        list.add(udb12);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 精神病基本信息
     */
    public void updateJSJBInfo() {
        List list = new ArrayList<>();
        // 精神病基本信息
        List<JsjbBaseInfo> newList = null;

        if (converJsjbInfo.size() > subSize) {
            newList = converJsjbInfo.subList(0, subSize);
            converJsjbInfo = converJsjbInfo.subList(subSize, converJsjbInfo.size());
            Log.e("*************", newList.size() + "***" + converJsjbInfo.size() + "*******************");
        } else {
            newList = converJsjbInfo;
            converJsjbInfo = null;
        }

        UploadDataBean udb3 = new UploadDataBean(ModuleName.UPLOAD_JSJB_BASEINFO,
                JX_UploadData.TYPE_JsjbBaseInfo, "MentalJson",
                "addMental", "Jsjb", newList);
        list.add(udb3);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

    /**
     * 精神病随访
     */
    public void updateJSJBSF() {
        List list = new ArrayList<>();
        // 精神病随访
        List<Jsjbsfb> newList = null;

        if (converJsjbsfb.size() > subSize) {
            newList = converJsjbsfb.subList(0, subSize);
            converJsjbsfb = converJsjbsfb.subList(subSize, converJsjbsfb.size());
            Log.e("*************", newList.size() + "***" + converJsjbsfb.size() + "*******************");
        } else {
            newList = converJsjbsfb;
            converJsjbsfb = null;
        }

        UploadDataBean udb3 = new UploadDataBean(ModuleName.UPLOAD_JSJB_FOLLOWUP,
                JX_UploadData.TYPE_JSJBSF, "MentalJson",
                "addMentalFollowup", "Jsjbsf", newList);
        list.add(udb3);

        ArchiveUploadDatas uld = new ArchiveUploadDatas(context, list);
        uld.uploadDatas();
    }

}
